# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Mike Crute <mike@crute.us>
pkgname=libupnp
pkgver=1.14.18
pkgrel=0
pkgdesc="Portable Open Source UPnP Development Kit"
url="https://pupnp.github.io/pupnp/"
arch="all"
license="BSD-3-Clause"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/pupnp/pupnp/archive/refs/tags/release-$pkgver.tar.gz
disable-failing-test.patch"
builddir="$srcdir"/pupnp-release-$pkgver

# secfixes:
#   1.12.1-r1:
#     - CVE-2020-13848

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-Dblocking_tcp_connections=OFF \
		-Dreuseaddr=ON \
		-Dsamples=OFF
	cmake --build build
}

check() {
	cmake --build build --target test
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
68973e0e5a8f9e64b2311246b7924b0837fd2c7ef30483d3d93ebfeee62bc2293760209d8a5213c0456ce5c37f9f32a6038c9e5d8b461670ba6073db8c2f1394  libupnp-1.14.18.tar.gz
f5890d2c1a3540fd1717eb038d1c4fc361b04e5a13be37d4f0ecbc574651b054b7326160c9399c6f7a4ce631c6ab912151d49a724615ee8f87138e4c0da9af0a  disable-failing-test.patch
"
